﻿@using JESAI.HttpRequestMonitor.Core.Abstracts
@{
    Layout = "~/Views/HttpRequestMonitor/HttpRequestMonitorTemplate.cshtml";

    List<IMonitorScheduleJobModel> list = ViewBag.list;

    var lang = ViewBag.Language as JESAI.HttpRequestMonitor.Dashboard.Services.Language.ILanguage;

}

    <style type="text/css">

        .table td, th {
            text-align: center;
            line-height: 24px !important;
        }
    </style>

    <div class="panel panel-default">

        <div class="panel-body" style="padding-left:30px;padding-right:30px;padding-top:30px;padding-bottom:30px">

            <div class="row">

                <div class="panel panel-default">
                    <div class="panel-body" style="padding-bottom:20px">

                        <div class="col-sm-12" style="margin-bottom:30px;padding:0">

                            <div class="col-sm-3" style="padding-left:0">

                            <a style="min-width:120px;" href="/HttpRequestMonitor/EditMonitor" class="btn btn-primary btn-search">@lang.Monitor_Add</a>

                            </div>

                        </div>

                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th>@lang.Monitor_Title</th>
                                    <th>@lang.Monitor_State</th>
                                    <th>@lang.Monitor_Frequency</th>
                                    <th>@lang.Monitor_Email</th>
                                    <th>@lang.Monitor_ServiceNode</th>
                                    <th width="276">@lang.Monitor_Operation</th>
                                </tr>
                            </thead>
                            <tbody>

                                @foreach (var item in list)
                                {
                                    <tr>
                                        <td>@item.Title</td>
                                        <td>

                                            @if (item.Status == 1)
                                            {
                                                <span style="width: 60px;padding-left:10px; padding-right:10px;margin-right: 8px;border-radius:0;" class="label label-success">@lang.Monitor_Runing</span>
                                            }
                                            else
                                            {
                                                <span style="width: 60px;padding-left:10px; padding-right:10px;margin-right: 8px;border-radius:0;" class="label label-danger">@lang.Monitor_Stoping</span>
                                            }

                                        </td>
                                        <td>@item.CronLike</td>
                                        <td>@item.Emails</td>
                                        <td>@item.Nodes</td>

                                        <td>

                                        <a href="/HttpRequestMonitor/EditMonitor/@item.Id" style="margin:4px" type="button" class="btn btn-info btn-xs"><span class="glyphicon glyphicon-edit"></span> @lang.Monitor_Edit</a>

                                            @if (item.Status == 1)
                                            {
                                                <button style="margin:4px" type="button" onclick="stopJob('@item.Id')" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-off"></span> @lang.Monitor_Stop</button>
                                            }
                                            else
                                            {
                                                <button style="margin:4px" type="button" onclick="startJob('@item.Id')" class="btn btn-success btn-xs"><span class="glyphicon glyphicon-play-circle"></span> @lang.Monitor_Start</button>
                                            }

                                            <button style="margin:4px" type="button" onclick="delJob('@item.Id')" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-remove-sign"></span> @lang.Monitor_Delete</button>

                                        </td>
                                    </tr>

                                }

                            </tbody>
                        </table>

                    </div>
                </div>

            </div>

        </div>

    </div> 

    <script src="/HttpRequestMonitorStaticFiles/Content/page/monitor.js?ver=1.0.4"></script>
